/*
 * Copyright (c) 2019-2020, Dmitry (DiSlord) dislordlive@gmail.com
 * All rights reserved.
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * The software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

//****************************************************************
//                    Icons used in plot area
//****************************************************************

// Reference bitmap (size and offset)
#define REFERENCE_WIDTH    6
#define REFERENCE_HEIGHT   5
#define REFERENCE_X_OFFSET 5
#define REFERENCE_Y_OFFSET 2
static const uint8_t reference_bitmap[]={
  _BMP8(0b11000000),
  _BMP8(0b11110000),
  _BMP8(0b11111100),
  _BMP8(0b11110000),
  _BMP8(0b11000000),
};

// Marker bitmaps (size and offsets)
#if _USE_MARKER_SET_ == 0
#define MARKER_WIDTH       7
#define MARKER_HEIGHT     10
#define X_MARKER_OFFSET    3
#define Y_MARKER_OFFSET   10
#define MARKER_BITMAP(i)  (&marker_bitmap[(i)*MARKER_HEIGHT])
#define MARKER_RBITMAP(i)  (&marker_bitmap[(i)*2*MARKER_HEIGHT + MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={
// Marker Back plate
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b01111100),
  _BMP8(0b00111000),
  _BMP8(0b00010000),

  _BMP8(0b00010000),
  _BMP8(0b00111000),
  _BMP8(0b01111100),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),
  _BMP8(0b11111110),

  // Marker 1
  _BMP8(0b00000000),
  _BMP8(0b00010000),
  _BMP8(0b00110000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b00010000),
  _BMP8(0b00110000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#if MARKERS_MAX >=2
  // Marker 2
  _BMP8(0b00000000),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b00000100),
  _BMP8(0b00111000),
  _BMP8(0b01000000),
  _BMP8(0b01111100),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b00000100),
  _BMP8(0b00111000),
  _BMP8(0b01000000),
  _BMP8(0b01111100),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
#if MARKERS_MAX >=3
  // Marker 3
  _BMP8(0b00000000),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b00011000),
  _BMP8(0b00000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b00011000),
  _BMP8(0b00000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
#if MARKERS_MAX >=4
  // Marker 4
  _BMP8(0b00000000),
  _BMP8(0b00001000),
  _BMP8(0b00011000),
  _BMP8(0b00101000),
  _BMP8(0b01001000),
  _BMP8(0b01001000),
  _BMP8(0b01111100),
  _BMP8(0b00001000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b00001000),
  _BMP8(0b00011000),
  _BMP8(0b00101000),
  _BMP8(0b01001000),
  _BMP8(0b01001000),
  _BMP8(0b01111100),
  _BMP8(0b00001000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
#if MARKERS_MAX >=5
  // Marker 5
  _BMP8(0b00000000),
  _BMP8(0b01111100),
  _BMP8(0b01000000),
  _BMP8(0b01111000),
  _BMP8(0b00000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b01111100),
  _BMP8(0b01000000),
  _BMP8(0b01111000),
  _BMP8(0b00000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
#if MARKERS_MAX >=6
  // Marker 6
  _BMP8(0b00000000),
  _BMP8(0b00111100),
  _BMP8(0b01000000),
  _BMP8(0b01111000),
  _BMP8(0b01000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b00111100),
  _BMP8(0b01000000),
  _BMP8(0b01111000),
  _BMP8(0b01000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
#if MARKERS_MAX >=7
  // Marker 7
  _BMP8(0b00000000),
  _BMP8(0b01111100),
  _BMP8(0b01000100),
  _BMP8(0b00000100),
  _BMP8(0b00001000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b01111100),
  _BMP8(0b01000100),
  _BMP8(0b00000100),
  _BMP8(0b00001000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00010000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
#if MARKERS_MAX >=8
  // Marker 8
  _BMP8(0b00000000),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),

  _BMP8(0b00000000),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b01000100),
  _BMP8(0b01000100),
  _BMP8(0b00111000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
  _BMP8(0b00000000),
#endif
};
#elif _USE_MARKER_SET_ == 1
#define MARKER_WIDTH       11
#define MARKER_HEIGHT      12
#define X_MARKER_OFFSET     5
#define Y_MARKER_OFFSET    12
#define MARKER_BITMAP(i)   (&marker_bitmap[(i)*4*MARKER_HEIGHT])
#define MARKER_RBITMAP(i)  (&marker_bitmap[(i)*4*MARKER_HEIGHT + 2*MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={
// Marker Back plate
  _BMP16(0b0000000000000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0011111110000000),
  _BMP16(0b0001111100000000),
  _BMP16(0b0000111000000000),
  _BMP16(0b0000010000000000),

  _BMP16(0b0000010000000000),
  _BMP16(0b0000111000000000),
  _BMP16(0b0001111100000000),
  _BMP16(0b0011111110000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0000000000000000),

// Marker 1
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000111000100000),
  _BMP16(0b1001011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b0100111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100011001000000),
  _BMP16(0b1000111000100000),
  _BMP16(0b1001011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#if MARKERS_MAX >=2
  // Marker 2
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=3
  // Marker 3
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=4
  // Marker 4
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1001101100100000),
  _BMP16(0b1011001100100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b0100001101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100001101000000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1001101100100000),
  _BMP16(0b1011001100100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=5
  // Marker 5
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=6
  // Marker 6
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=7
  // Marker 7
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b0100110001000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b0100110001000000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=8
  // Marker 8
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
};
#elif _USE_MARKER_SET_ == 2
#define MARKER_WIDTH       11
#define MARKER_HEIGHT      14
#define X_MARKER_OFFSET     5
#define Y_MARKER_OFFSET    14
#define MARKER_BITMAP(i)   (&marker_bitmap[(i)*4*MARKER_HEIGHT])
#define MARKER_RBITMAP(i)  (&marker_bitmap[(i)*4*MARKER_HEIGHT + 2*MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={
  // Marker Back plate
  _BMP16(0b0000000000000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0011111110000000),
  _BMP16(0b0001111100000000),
  _BMP16(0b0000111000000000),
  _BMP16(0b0000010000000000),

  _BMP16(0b0000010000000000),
  _BMP16(0b0000111000000000),
  _BMP16(0b0001111100000000),
  _BMP16(0b0011111110000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0111111111000000),
  _BMP16(0b0000000000000000),

  // Marker 1
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000111000100000),
  _BMP16(0b1001011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b0100111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100011001000000),
  _BMP16(0b1000111000100000),
  _BMP16(0b1001011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#if MARKERS_MAX >=2
  // Marker 2
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1001100110100000),
  _BMP16(0b1001100110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000111000100000),
  _BMP16(0b1001100000100000),
  _BMP16(0b1001100000100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100111101000000),
  _BMP16(0b1001100110100000),
  _BMP16(0b1001100110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000111000100000),
  _BMP16(0b1001100000100000),
  _BMP16(0b1001100000100000),
  _BMP16(0b1001111110100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=3
  // Marker 3
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=4
  // Marker 4
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1001101100100000),
  _BMP16(0b1011001100100000),
  _BMP16(0b1011001100100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b0100001101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100001101000000),
  _BMP16(0b1000011100100000),
  _BMP16(0b1000111100100000),
  _BMP16(0b1001101100100000),
  _BMP16(0b1011001100100000),
  _BMP16(0b1011001100100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=5
  // Marker 5
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100000001000000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=6
  // Marker 6
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011011100100000),
  _BMP16(0b1011100110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000000100000),
  _BMP16(0b1011011100100000),
  _BMP16(0b1011100110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=7
  // Marker 7
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b0100110001000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0100000001000000),
  _BMP16(0b1011111110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1000000110100000),
  _BMP16(0b1000001100100000),
  _BMP16(0b1000011000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1000110000100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
#if MARKERS_MAX >=8
  // Marker 8
  _BMP16(0b1111111111100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b0101111101000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0000101000000000),

  _BMP16(0b0000101000000000),
  _BMP16(0b0001000100000000),
  _BMP16(0b0010000010000000),
  _BMP16(0b0101111101000000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1011000110100000),
  _BMP16(0b1001111100100000),
  _BMP16(0b1000000000100000),
  _BMP16(0b1111111111100000),
#endif
};
#elif _USE_MARKER_SET_ == 3
#define MARKER_WIDTH       13
#define MARKER_HEIGHT      16
#define X_MARKER_OFFSET     6
#define Y_MARKER_OFFSET    16
#define MARKER_BITMAP(i)   (&marker_bitmap[(i)*4*MARKER_HEIGHT])
#define MARKER_RBITMAP(i)  (&marker_bitmap[(i)*4*MARKER_HEIGHT + 2*MARKER_HEIGHT])
static const uint8_t marker_bitmap[]={
  // Marker Back plate
  _BMP16(0b0000000000000000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0011111111100000),
  _BMP16(0b0001111111000000),
  _BMP16(0b0000111110000000),
  _BMP16(0b0000011100000000),
  _BMP16(0b0000001000000000),

  _BMP16(0b0000001000000000),
  _BMP16(0b0000011100000000),
  _BMP16(0b0000111110000000),
  _BMP16(0b0001111111000000),
  _BMP16(0b0011111111100000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0111111111110000),
  _BMP16(0b0000000000000000),

  // Marker 1
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000011100001000),
  _BMP16(0b1000101100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b0100111111010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0100001100010000),
  _BMP16(0b1000011100001000),
  _BMP16(0b1000101100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000111111001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#if MARKERS_MAX >=2
  // Marker 2
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1000111110001000),
  _BMP16(0b1001100011001000),
  _BMP16(0b1001100011001000),
  _BMP16(0b1000000011001000),
  _BMP16(0b1000000110001000),
  _BMP16(0b1000011100001000),
  _BMP16(0b1000110000001000),
  _BMP16(0b1001100000001000),
  _BMP16(0b1001100000001000),
  _BMP16(0b0101111111010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0100111110010000),
  _BMP16(0b1001100011001000),
  _BMP16(0b1001100011001000),
  _BMP16(0b1000000011001000),
  _BMP16(0b1000000110001000),
  _BMP16(0b1000011100001000),
  _BMP16(0b1000110000001000),
  _BMP16(0b1001100000001000),
  _BMP16(0b1001100000001000),
  _BMP16(0b10011111110010000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
#if MARKERS_MAX >=3
  // Marker 3
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000001111001000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b0101111111010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0101111111010000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000001111001000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
#if MARKERS_MAX >=4
  // Marker 4
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1000000111001000),
  _BMP16(0b1000001111001000),
  _BMP16(0b1000011111001000),
  _BMP16(0b1000110011001000),
  _BMP16(0b1001100011001000),
  _BMP16(0b1011000011001000),
  _BMP16(0b1011000011001000),
  _BMP16(0b1011111111101000),
  _BMP16(0b1000000011001000),
  _BMP16(0b0100000011010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0100000111010000),
  _BMP16(0b1000001111001000),
  _BMP16(0b1000011111001000),
  _BMP16(0b1000110011001000),
  _BMP16(0b1001100011001000),
  _BMP16(0b1011000011001000),
  _BMP16(0b1011000011001000),
  _BMP16(0b1011111111101000),
  _BMP16(0b1000000011001000),
  _BMP16(0b1000000011001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
#if MARKERS_MAX >=5
  // Marker 5
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1011111111101000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b0101111111001000),
  _BMP16(0b0010000000010000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0100000000010000),
  _BMP16(0b1011111111101000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b0101111111001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
#if MARKERS_MAX >=6
  // Marker 6
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011011111001000),
  _BMP16(0b1011100001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b0101111111010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0101111111010000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011000000001000),
  _BMP16(0b1011011111001000),
  _BMP16(0b1011100001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
#if MARKERS_MAX >=7
  // Marker 7
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1011111111101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000000011001000),
  _BMP16(0b1000000110001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000011000001000),
  _BMP16(0b1000011000001000),
  _BMP16(0b1000011000001000),
  _BMP16(0b0100011000010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0100000000010000),
  _BMP16(0b1011111111101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1000000001101000),
  _BMP16(0b1000000011001000),
  _BMP16(0b1000000110001000),
  _BMP16(0b1000001100001000),
  _BMP16(0b1000011000001000),
  _BMP16(0b1000011000001000),
  _BMP16(0b1000011000001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
#if MARKERS_MAX >=8
  // Marker 8
  _BMP16(0b1111111111111000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b0101111111010000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0000010100000000),

  _BMP16(0b0000010100000000),
  _BMP16(0b0000100010000000),
  _BMP16(0b0001000001000000),
  _BMP16(0b0010000000100000),
  _BMP16(0b0101111111010000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1011000001101000),
  _BMP16(0b1001111111001000),
  _BMP16(0b1000000000001000),
  _BMP16(0b1111111111111000),
#endif
};
#endif
